/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.service;

import com.comac.ins.common.BaseResult;
import com.comac.ins.config.FeignConfiguration;
import com.comac.ins.vo.req.SelectAppResourceReqVO;
import com.comac.ins.vo.req.SelectRoleResourceReqVO;
import com.comac.ins.vo.req.SelectUserResourceReqVO;
import com.comac.ins.vo.res.RpcResourceResVO;
import com.comac.ins.vo.res.UserResourceResVO;
import io.swagger.annotations.Api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author fan.tianpeng
 * @date 2021/5/13 9:35
 */
//不兼容现有资源模型，暂时弃用待改
@FeignClient(url = "${feign.userCenterUrl:}", value = "usercenter-service", contextId = "usercenter-resource", configuration = FeignConfiguration.class)
@Api(value = "资源管理", tags = "资源管理")
public interface ResourceFeignService {

    //查询用户所拥有的资源(菜单和按钮)列表
    @RequestMapping(value = "feignApi/userCenter/resource/qryResourceListByUserId", method = RequestMethod.POST)
    BaseResult<UserResourceResVO> qryResourceListByUserId(@RequestBody SelectUserResourceReqVO vo);

    //查询树状的菜单资源(菜单和按钮)列表
//    @RequestMapping(value = "feignApi/userCenter/resource/qryAllResourceList", method = RequestMethod.GET)
//    BaseResult<List<ResourceDetailInfoResVO>> qryAllResourceList(@RequestParam("tantentcode") String tantentcode);

    /**
     * 查询角色所拥有的资源(菜单和按钮)列表
     * 说明：1.根据查询条件查询出菜单
     * 2.查询出菜单下所有按钮
     * 3.根据角色id标记已授权按钮,已授权的按钮roleIdList不为空，roleIdList存放有该按钮权限的角色id
     *
     * @param vo
     * @return
     */
    @RequestMapping(value = "feignApi/userCenter/resource/qryResourceListByRoleId", method = RequestMethod.POST)
    BaseResult<RpcResourceResVO> qryResourceListByRoleId(@RequestBody @Validated SelectRoleResourceReqVO vo);

    /**
     * 通过租户编码和资源路径清单查询资源详细清单
     *
     * @param vo
     * @return
     */
    @RequestMapping(value = "feignApi/userCenter/resource/qryResourceListByAppOrPath", method = RequestMethod.POST)
    BaseResult<RpcResourceResVO> qryResourceListByAppOrPath(@RequestBody SelectAppResourceReqVO vo);
}
